﻿USE [Axium]
GO
/****** Object:  StoredProcedure [dbo].[GetAllModels]    Script Date: 06/20/2012 00:01:19 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetAllModels]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetAllModels]
GO
/****** Object:  StoredProcedure [dbo].[GetModel]    Script Date: 06/20/2012 00:01:19 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetModel]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetModel]
GO
/****** Object:  Table [dbo].[SomeModel]    Script Date: 06/20/2012 00:01:19 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SomeModel]') AND type in (N'U'))
DROP TABLE [dbo].[SomeModel]
GO
/****** Object:  Table [dbo].[SomeModel]    Script Date: 06/20/2012 00:01:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SomeModel]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SomeModel](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[MRN] [varchar](10) NOT NULL,
	[OrderNum] [int] NOT NULL,
	[NDC] [smallint] NOT NULL,
	[DrugName] [text] NOT NULL,
	[Quantity] [bigint] NOT NULL,
	[HCPC] [numeric](18, 8) NOT NULL,
	[HCPCBilling] [money] NOT NULL,
	[TotalQWP] [money] NOT NULL,
	[Discount] [smallmoney] NOT NULL,
	[Quote] [bit] NOT NULL,
	[ICD9_Primary] [numeric](18, 8) NOT NULL,
	[QtyAllowed] [bigint] NOT NULL,
	[DateEntered] [datetime] NOT NULL,
	[test] [varchar](max) NOT NULL,
	[FloatTest] [float] NOT NULL,
 CONSTRAINT [PK_SomeModel] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  StoredProcedure [dbo].[GetModel]    Script Date: 06/20/2012 00:01:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetModel]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[GetModel]
@Id	INT
AS
BEGIN
	SET NOCOUNT ON;

    
	SELECT * FROM SomeModel WHERE Id = @id
END
' 
END
GO
/****** Object:  StoredProcedure [dbo].[GetAllModels]    Script Date: 06/20/2012 00:01:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetAllModels]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[GetAllModels]
AS
BEGIN
	SET NOCOUNT ON;

    
	SELECT * FROM SomeModel
END
' 
END
GO
